#ifndef _DEVICE_H_
#define _DEVICE_H_

#define INPUT_LENGTH        (20)

#define IPV4_ADDRESS_NUM    (4)

/* 用户输入错误的socket param */
#define SOCKET_TYPE_ERROR           (-1)
#define SOCKET_DOMAIN_ERROR         (-2)
#define SOCKET_IPV4_ADDRESS_ERROR   (-3)
#define SOCKET_PORT_ERROR           (-4)
#define SOCKET_LISTEN_NUM_ERROR     (-5)

#define BIND_ERROR                  (-6)
#define LISTEN_ERROR                (-7)
#define SOCKET_ERROR                (-8)

#define MAX_THREAD_NUM              (5)
#define MAX_CLIENT_NUM              (1024)

#define SELECT_TIME_OUT             (0)
#define SELECT_ERROR                (-1)

struct socket_param {
    char *ipv4_address;

    int socket_type;
    int socket_domain;
    /* 服务器端口 */
    int socket_port_num;
    /* 侦听长度 */
    int listen_num;
};

struct user_input_param {
    char *ipv4_address;
    char *socket_type;
    char *socket_domain;
    /* 服务器端口 */
    char *socket_port_num;
    /* 侦听长度 */
    char *listen_num;
};

struct pthread_arg {
    int connect_num;
    int socket_fd;
    int *connect_host;
};

extern int deal_user_input_param(char *argv[]);

#endif